package boerse.main.Asset;

import boerse.main.Exceptions.*;

public class CashAccount extends Assets{
	
	private long money = 0; 	//in cent
	
	public CashAccount (String name) {
		super(name);
	}
	
	public long determinePrice() {
		return money;
	}
	
	public void addMoney(long money) throws NegativeValueException {
		if (money < 0)
			throw new NegativeValueException();
		this.money += money;
	}
	
	public void removeMoney(long money) throws NotEnoughMoneyException, NegativeValueException {  
		if (money < 0) {
			throw new NegativeValueException();
		}
		
		if (this.money - money < 0)
			throw new NotEnoughMoneyException("Negative Cash is not allowed.");
		
		this.money -= money;
	}
}
